package com.zyh.zhukang.productdetails.controller;

import com.zyh.zhukang.productdetails.entity.ProductInfo;
import com.zyh.zhukang.productdetails.service.ProductService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 作者:zhuyunhao
 * 时间:2020/1/15 0015 11:00
 */

@Controller
@RequestMapping("/productinfo")
public class ProductDetailsController {
    @Resource
    private ProductService productService;

    //根据商品id查询商品详情
    @RequestMapping("/info")
    @ResponseBody
    public ProductInfo getProductInfo(Integer productId){
        ProductInfo productInfo = productService.getProductInto(productId);
        System.out.println(productInfo);
        return productInfo;
    }
}
